package com.walleipt.demo.ioc.orderComparator;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.springframework.core.PriorityOrdered;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		AnnotationAwareOrderComparator comparatorToUse = new AnnotationAwareOrderComparator();
		List<PriorityOrdered> priorityOrdereds = new ArrayList<PriorityOrdered>() ;
		priorityOrdereds.add( (PriorityOrdered) new MyPriorityOrdered(3) );
		priorityOrdereds.add( (PriorityOrdered) new MyPriorityOrdered(1) );
		priorityOrdereds.add( (PriorityOrdered) new MyPriorityOrdered(5) );
		
		Collections.sort(priorityOrdereds, comparatorToUse);
		
		for (PriorityOrdered priorityOrdered : priorityOrdereds) {
			System.err.println(priorityOrdered.getOrder());			
		}
	}
	

}
